package com.taxshare.seller.remote;

import com.taxshare.seller.aspect.SLog;
import com.taxshare.seller.view.dto.InterfaceDTO;
import com.taxshare.seller.view.dto.WriteBackInvoiceDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.taxshare.response.beans.Response;
import com.taxshare.seller.view.dto.SellerInvoiceDTO;

/**
 * @ClassName: ApiClientService
 * @Description:
 * @author: luozhongyi
 * @date: 2021/4/1 9:35
 */
@FeignClient(name = "tax-api", fallback = ApiClientService.HystrixFallBack.class)
@Component
public interface ApiClientService {

    @SLog
    @RequestMapping(value = "/seller/callSST", method = RequestMethod.POST)
    Response callSST(@RequestBody SellerInvoiceDTO bean);

    @SLog
    @RequestMapping(value = "/seller/callSales", method = RequestMethod.POST)
    Response callSales(@RequestBody InterfaceDTO interfaceDTO);

    @SLog
    @RequestMapping(value = "/seller/autoHead", method = RequestMethod.POST)
    Response autoHead(@RequestBody SellerInvoiceDTO bean);

    @SLog
    @RequestMapping(value = "/seller/writeBackIncoice", method = RequestMethod.POST)
    Response writeBackIncoice(@RequestBody WriteBackInvoiceDTO writeBackInvoiceDTO);

    @SLog
    @RequestMapping(value = "/seller/syncProjectInfo", method = RequestMethod.POST)
    Response syncProjectInfo();

    @Component
    class HystrixFallBack implements ApiClientService {
        @Override
        public Response callSST(@RequestBody SellerInvoiceDTO bean) {
            return null;
        }

        @Override
        public Response callSales(@RequestBody InterfaceDTO interfaceDTO) {
            return null;
        }

        @Override
        public Response autoHead(@RequestBody SellerInvoiceDTO bean) {
            return null;
        }

        @Override
        public Response writeBackIncoice(@RequestBody WriteBackInvoiceDTO writeBackInvoiceDTO) {
            return null;
        }

        @Override
        public Response syncProjectInfo() {
            return null;
        }
    }
}
